#ifndef _BLURRENDER_H_
#define _BLURRENDER_H_

#include "CDirect3D.h"

class BlurEffect;

struct VertexType
{
	XMFLOAT3 position;
	XMFLOAT2 texture;
};

class BlurRender
{
public:
	BlurRender();
	BlurRender(const BlurRender&);
	~BlurRender();

	void Initialize();
	void Update();
	void Render();

	ID3D11ShaderResourceView* GetRenderTexture();
	void SetTextureToBlur(ID3D11ShaderResourceView* pTexture);
private:
	void InitializeBuffers();

	CDirect3D* mCDirect3D;
	ID3D11DeviceContext* mDeviceContext;
	ID3D11Device* mDevice;

	int mWidth;
	int mHeight;

	BlurEffect* mHorizontalBlurEffect;
	BlurEffect* mVerticalBlurEffect;
	ID3D11ShaderResourceView* mTextureToBlur;
	ID3D11ShaderResourceView* mRenderTextureResource;
	ID3D11ShaderResourceView* mIntermediateRenderTextureResource;
	ID3D11Texture2D* mRenderTexture;
	ID3D11Texture2D* mIntermediateRenderTexture;

	ID3D11DepthStencilView* mStencilView;
	ID3D11RenderTargetView* mRenderTargetView;
	ID3D11RenderTargetView* mIntermediateRenderTargetView;
	ID3D11Texture2D* mTextureDepthBuffer;

	D3D11_VIEWPORT mViewport;

	int mIndexCount;
	ID3D11Buffer *mVertexBuffer, *mIndexBuffer;

	XMFLOAT4X4 mWorldMatrix;
	XMFLOAT4X4 mViewMatrix;
	XMFLOAT4X4 mProjectionMatrix;
};

#endif